<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String yearmonthstr = (String)request.getAttribute("yearmonthstr");
String department = (String)request.getAttribute("department");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <base href="<%=basePath %>"/>
	<title>天津市计算机研究所</title>
	<meta http-equiv="x-ua-compatible" content="ie=7" />	
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="<%=basePath %>articles/style/css.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath %>articles/style/houtaianniu.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
	  .red-row{
				background-color: red !important;
			}
		.yellow-row{
				background-color: yellow !important;
			}
		.blue-row{
				background-color: blue !important;
			}				
		.silk-add{
        background-image:url(<%=basePath %>ajaxFramework/ext-2.1/shared/icons/fam/add.gif) !important;
	</style>
	<script  src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	<script  src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
    <script src="<%=basePath %>ajaxFramework/ext-2.1/menu/EditableItem.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/menu/RangeMenu.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/grid/GridFilters.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/grid/filter/Filter.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/grid/filter/StringFilter.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/grid/filter/DateFilter.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/grid/filter/ListFilter.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/grid/filter/NumericFilter.js"></script>
	<script src="<%=basePath %>ajaxFramework/ext-2.1/grid/filter/BooleanFilter.js"></script>
	<script  src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
	<script  src="<%=basePath %>articles/manage/js/rulesManageList.js"></script>
	<script >

	function initDepartmentSummaryList(){
		 Ext.BLANK_IMAGE_URL=Ext.get('basePath').getValue()+"ajaxFramework/ext-2.1/resources/images/default/s.gif";		 
		 /**
		 * 表格各列定义
		 */
		  	var _columnModle = new Ext.grid.ColumnModel({
		 		columns:[
		 		{
		 			header: "部门名称", menuDisabled: false,dataIndex:'deptName'
		 		},{
		 			header: "上报时间", menuDisabled: false,dataIndex:'createdatestr',width:30
	 			},{
		 			header: "是否上报", menuDisabled: false,dataIndex:'issumary',width:30
		 		},{
		 			header: "上报人", menuDisabled: false,dataIndex:'createuser',width:30
		 		},{
		 			header: "操作", menuDisabled: false,dataIndex:'tablename',width:30,renderer:function(s,m,rec){
		 				var str = "";
		 				if(rec.data.issumary !="未填写" && rec.data.islocaldepment == 0){
		 					str = "<a href=\"" +Ext.get('basePath').getValue()+ "tjsinfo/tjsoa/articles/Summary.do?method=viewSummary&summaryid="+rec.data.summaryid+"\">查看</a>";
		 				}else if(rec.data.islocaldepment > 0 && rec.data.issumary =="已填写"){
		 					str = "<a href=\"" +Ext.get('basePath').getValue()+ "tjsinfo/tjsoa/articles/Summary.do?method=viewSummary&summaryid="+rec.data.summaryid+"\">查看</a>&nbsp;&nbsp;<a href=\"" +Ext.get('basePath').getValue()+ "tjsinfo/tjsoa/articles/Summary.do?method=toUpdateSummary&summaryid="+rec.data.summaryid+"\">修改</a>";
		 				}else if(rec.data.islocaldepment > 0 && rec.data.issumary =="未填写"){
		 					str = "<a href=\"" +Ext.get('basePath').getValue()+ "tjsinfo/tjsoa/articles/Summary.do?method=toAddSummary&depmentId="+rec.data.id+"&yearmonthstr=<%=yearmonthstr%>\">上报</a>";
		 				}
		 				return str;
		 			}
		 		}]
		 	});

		  	/**
			 * 获取表格中显示的内容
			 */
				_store = new Ext.data.JsonStore({
			 		fields:['id','deptName','issumary','createdatestr','createuser','islocaldepment','summaryid'],
			 		url: Ext.get('basePath').getValue()+ 'tjsinfo/tjsoa/articles/Summary.do',
			 		method : 'POST',
			 		baseParams : {
			 			method : 'departmentSummaryList',
			 			yearmonthstr : '<%=yearmonthstr%>'
		            }
			 	});
		  		
		  	 
		  	/**   
			 * 翻页工具栏
			 */
			 	var _toolbar;
			
				_toolbar = new Ext.Toolbar({
						items : [ {
							text : '返回',
							handler : function() {
								history.go(-1);		
							}					
						} ]
				});

			/**   
			 * 翻页工具栏
			 */
			var _table = new Ext.grid.GridPanel({
				colModel : _columnModle,
				store : _store,
				width : Ext.get("showRegional").getWidth(),
				height : Ext.get("showRegional").getHeight(),
				renderTo : Ext.get('showRegional'),
				frame : true,
				viewConfig : {
					forceFit : true
				},
				layout : 'fit',// 表格内列内容填充满,按列头比例填充 			
				stripeRows : true,
				tbar : _toolbar
			});
			_store.load();
			
			

		}
	</script>
  </head>
  
    <body  onload="initDepartmentSummaryList()">
  	  <div id="index" style="width:100%;height:600px;">
	  <div id="showRegional" style="width:100%;height:100%;"></div>
	  <input type="hidden" value="<%=basePath %>" id="basePath"/>
	  <input type="hidden" value="<%=department %>" id="department"/>
	  
	  
	  </div>
  </body>
  
</html>
